package cn.edu.zut.hhr;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@MapperScan(basePackages = "cn.edu.zut.hhr.mapper")
@ServletComponentScan
@EnableEurekaClient
@EnableCircuitBreaker
public class Dept8082 {

    public static void main(String[] args) {
        SpringApplication.run(Dept8082.class,args);
    }

    @Bean
    public ServletRegistrationBean<HystrixMetricsStreamServlet> hystrixMetricsStreamServletServletRegistrationBean(){
        ServletRegistrationBean<HystrixMetricsStreamServlet> servletRegistrationBean= new ServletRegistrationBean<>(new HystrixMetricsStreamServlet());
        servletRegistrationBean.addUrlMappings("/actuator/hystrix.stream");
        return  servletRegistrationBean;
    }

}
